package com.mapper;

import com.POJO.Class;
import java.util.List;

import org.apache.ibatis.annotations.*;

/**
 * @Package com.mapper
 * @Date 2024-05-23 11:30
 * 班级相关数据库操作
 */

@Mapper
public interface ClassMapper {
    // 获取所有班级
    @Select("select * from classes")
    List<Class> getAllClasses();

    // 新增班级
    @Insert("INSERT INTO classes(class_id,class_name) values (#{classId},#{className})")
    @Options(useGeneratedKeys = true, keyProperty = "classId")
    void insertClass(Class clazz);

    // 更新班级信息
    @Update("UPDATE classes set classname = #{className} where class_id =#{classId}")
    void updateClass(Class clazz);

    // 删除班级
    @Delete("delete from classes where class_id = #{classId}")
    void deleteClass(int classId);
}
